#include<iostream>
#include<string>
#include<unordered_map>
using namespace std;

class Solution {
public:
	bool isAnagram(string s, string t) {
		unordered_map<char, int> dict;
		for (char c : s) {
			dict[c]++;
		}
		for (int i = 0; i < t.size(); i++) {
			if (dict.count(t[i])) {
				dict[t[i]]--;
			}
			else return false;
		}
		for (auto& it : dict) {
			if (it.second != 0)
				return false;
		}
		return true;
	}
};

int main() {
	string str = "anagram", t = "nagaram";
	Solution s;
	if (s.isAnagram(str,t))
		cout << "1";
	else cout << "2";
}